(function () {
    mySiderMenu = {
        initDocumentMenu: function (groupPos = 0, showPos, showSubPos) {
            var menu = [
                {
                    title: '通用功能',
                    group: [{
                        title: "工作首页",
                        id: 'submenu00',
                        href: "#submenu00",
                        icon: "home",
                        items: [{
                            title: "业务展示板 (支行)",
                            href: "./dashboard_1.html",
                            msg: ""
                        }, {
                            title: "业务展示板 (总分行)",
                            href: "./dashboard_2.html",
                            msg: ""
                        }, {
                            title: "待办任务",
                            href: "./client_list.html",
                            msg: "2"
                        }, {
                            title: "待办任务",
                            href: "./client_list.html",
                            msg: "2"
                        }, {
                            title: "已办任务",
                            href: "./counterparty_YSE_list.html",
                            msg: "20"
                        }]
                    }, {
                        title: "客户管理",
                        id: 'submenu01',
                        href: "#submenu01",
                        icon: "users",
                        items: [{
                            title: "客户信息管理",
                            href: "./client_list.html",
                            msg: "2"
                        }, {
                            title: "外部客户映射管理",
                            href: "./client_platform_map_list.html",
                            msg: "2"
                        }, {
                            title: "虚拟客户信息管理",
                            href: "./platform_list.html",
                            msg: "2"
                        }]
                    }, {
                        title: "项目与协议管理",
                        id: 'submenu02',
                        href: "#submenu02",
                        icon: "codepen",
                        items: [{
                            title: "项目方案维护",
                            href: "./project_list.html",
                            icon: "layers"
                        }, {
                            title: "协议方案维护",
                            href: "./contract_list.html",
                            icon: "tablet"
                        }]
                    }, {
                        title: "限额管理",
                        id: 'submenu04',
                        href: "#submenu04",

                        icon: "sliders",
                        items: [{
                            title: "平台限额管理",
                            href: "./project_list.html",
                            icon: "layers"
                        }, {
                            title: "限额监控",
                            href: "./contract_list.html",
                            icon: "tablet"
                        }]
                    }, {
                        title: "综合管理",
                        id: 'submenu05',
                        href: "#submenu05",

                        icon: "monitor",
                        items: [{
                            title: "集中查询与打印",
                            href: "",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "放款订单异常处理",
                            href: "./scf_core_xin_create.html",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "来账订单处理",
                            href: "",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }]
                    },
                    {
                        title: "综合查询",
                        id: 'submenu06',
                        href: "#submenu06",
                        icon: "aperture",
                        items: [{
                            title: "融资申请查询",
                            href: "",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "融资借据查询",
                            href: "./scf_core_xin_create.html",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "回款查询",
                            href: "./scf_core_xin_create.html",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }]
                    }, {
                        title: "系统管理",
                        id: 'submenu07',
                        href: "#submenu07",
                        icon: "info",
                        items: [{
                            title: "机构管理",
                            href: "",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "用户管理",
                            href: "./scf_core_xin_create.html",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "角色管理",
                            href: "",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "权限管理",
                            href: "./scf_core_xin_create.html",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "自动化参数管理",
                            href: "./scf_core_xin_create.html",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "字典管理",
                            href: "./scf_core_xin_create.html",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }, {
                            title: "流程配置",
                            href: "./scf_core_xin_create.html",
                            icon: "fa fa-pencil-square-o fa-lg"
                        }]
                    }]
                },
                {
                    title: '信融E功能',
                    group: [
                        {
                            title: "融资管理",
                            id: 'submenu10',
                            href: "#submenu10",
                            icon: "tag",
                            items: [{
                                title: "融资受理审批",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }, {
                            title: "信融E发票验真",
                            id: 'submenu13',
                            href: "#submenu13",
                            icon: "tag"

                        }, {
                            title: "中登网登记管理",
                            id: 'submenu14',
                            href: "#submenu14",
                            icon: "tag",
                            items: [{
                                title: "中登网登记",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "中登网登记撤销",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }, {
                            title: "综合查询",
                            id: 'submenu11',
                            href: "#submenu11",
                            icon: "aperture",
                            items: [{
                                title: "应收账款查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "融资借据查询",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "费用查询",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }, {
                            title: "预警管理",
                            id: 'submenu12',
                            href: "#submenu12",
                            icon: "monitor",
                            items: [{
                                title: "业务头寸维护",
                                href: "business_amt_list.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }]
                },
                {
                    title: '应收E功能',
                    group: [
                        {
                            title: "买方管理",
                            id: 'submenu20',
                            href: "#submenu20",
                            icon: "tag",
                            items: [{
                                title: "应收账款买方管理",
                                href: "",
                                msg: "20"
                            }]
                        }, {
                            title: "应收账款管理",
                            id: 'submenu21',
                            href: "#submenu21",
                            icon: "tag",
                            items: [{
                                title: "应收账款资产管理",
                                href: "./demo_客户_应收账款.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "单据验真",
                                href: "./ar_recieve_valid_list.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        },   {
                            title: "融资管理",
                            id: 'submenu25',
                            href: "#submenu25",
                            icon: "tag",
                            items: [{
                                title: "融资受理",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "提前还款",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }, {
                            title: "综合查询",
                            id: 'submenu22',
                            href: "#submenu22",
                            icon: "aperture",
                            items: [{
                                title: "应收账款查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "监管方查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "货物查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "对账查询",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "融资申请查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "融资借据查询",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "费用查询",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }, {
                            title: "预警管理",
                            id: 'submenu23',
                            href: "#submenu23",
                            icon: "monitor",
                            items: [{
                                title: "业务头寸维护",
                                href: "business_amt_list.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }]
                },
                {
                    title: '订单融资功能',
                    group: [
                        {
                            title: "订单管理",
                            id: 'submenu30',
                            href: "#submenu30",
                            icon: "tag",
                            items: [{
                                title: "应收账款买方管理",
                                href: "./counterparty_YSE_list.html",
                                msg: "20"
                            }]
                        }, {
                            title: "融资管理",
                            id: 'submenu31',
                            href: "#submenu31",
                            icon: "tag",
                            items: [{
                                title: "提前还款",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "溢出款划拨",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }, {
                            title: "中登网登记管理",
                            id: 'submenu34',
                            href: "#submenu34",
                            icon: "tag",
                            items: [{
                                title: "中登网登记",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "中登网登记撤销",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        },{
                            title: "查询",
                            id: 'submenu32',
                            href: "#submenu32",
                            icon: "aperture",
                            items: [{
                                title: "应收账款查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "监管方查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "货物查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "对账查询",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "融资申请查询",
                                href: "",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "融资借据查询",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }, {
                                title: "费用查询",
                                href: "./scf_core_xin_create.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }, {
                            title: "预警管理",
                            id: 'submenu38',
                            href: "#submenu38",
                            icon: "monitor",
                            items: [{
                                title: "业务头寸维护",
                                href: "business_amt_list.html",
                                icon: "fa fa-pencil-square-o fa-lg"
                            }]
                        }]
                }
            ];
            var ul = document.createElement("ul");
            ul.className = 'sidebar-nav'

            for (var k in menu) { //遍历json数组时，这么写p为索引，0,1
                var li = document.createElement('li')

                li.className = k == groupPos ? 'sidebar-header ' : 'sidebar-header top-border'
                li.innerHTML = menu[k].title

                ul.appendChild(li)
                group = menu[k].group
                for (var index in group) {
                    var li = document.createElement("li");
                    li.className = 'sidebar-item';
                    if (k == groupPos && index == showPos) {
                        li.className = 'sidebar-item active';
                    }
                    var a = document.createElement("a");
                    a.className = "sidebar-link collapsed"
                    if (k == groupPos && index == showPos) {

                        a.className = 'sidebar-link';
                    }

                    a.href = group[index].href;
                    var i = document.createElement("i");
                    i.className = 'align-middle';
                    i.setAttribute("data-feather", group[index].icon)
                    var span = document.createElement("span");
                    span.innerHTML = group[index].title

                    var subUL = document.createElement("ul");
                    subUL.setAttribute("id", group[index].id)
                    subUL.setAttribute("class", "sidebar-dropdown list-unstyled collapse")
                    if (k == groupPos && index == showPos) {
                        subUL.setAttribute("class", "sidebar-dropdown list-unstyled show")
                    }

                    for (var subIndex in group[index].items) {

                        var subLI = document.createElement("li");
                        subLI.className = 'sidebar-item'

                        if (k == groupPos && index == showPos && subIndex == showSubPos) {
                            subLI.className = 'sidebar-item active'

                        }
                        var subA = document.createElement("a");
                        subA.className = 'sidebar-link'
                        subA.href = group[index].items[subIndex].href
                        subA.innerHTML = group[index].items[subIndex].title

                        if (typeof (group[index].items[subIndex].msg) != "undefined") {

                            var subSPAN = document.createElement("span");
                            subSPAN.className = 'sidebar-badge badge badge-primary'
                            subSPAN.innerHTML = group[index].items[subIndex].msg
                            subA.appendChild(subSPAN)


                        }
                        subLI.appendChild(subA)

                        subUL.appendChild(subLI)
                    }
                    a.appendChild(i)
                    a.appendChild(span)
                    li.appendChild(a)
                    if (subUL.childElementCount > 0) {
                        li.appendChild(subUL)
                        a.setAttribute("data-toggle", "collapse")
                    }

                    ul.appendChild(li)


                }




            }



            return ul;


        }



    }





})()
